<?php
/**
 * 描述
 * Created by Paco
 * Date: 2019/1/24 Time: 14:58
 */

namespace App\Http\Request\Product;


use App\Http\Request\Store;

class CategoryStore extends Store
{
    public function rules()
    {
        $method = strtoupper($this->method());
        $rules = [
            'name'=>'required',
            'pid'=>'required|integer',
            'sort'=>'required|integer',
            'template_id'=>'required|integer',
        ];
        if ($method == 'POST') {
            return $rules;
        } elseif ($method == 'PUT') {
            $rules['cat_id'] = 'required|integer';
            return $rules;
        }
    }

    public function attributes()
    {
        return [
            'name'=>'分类名称',
            'pid'=>'分类父ID',
            'sort'=>'排序',
            'template_id'=>'产品模型ID',
        ];

    }
}